package easy;

import util.PrintUtils;

import java.util.ArrayList;
import java.util.List;

public class Solution_1656 {

    private int ptr;
    private String[] arrayVal;

    public Solution_1656(int n) {
        arrayVal = new String[n+1];
        ptr = 1;
    }

    public List<String> insert(int idKey, String value) {
        List<String> list = new ArrayList<>();
        arrayVal[idKey] = value;
        for (; ptr < arrayVal.length;) {
            if (arrayVal[ptr] == null) {
                break;
            }
            list.add(arrayVal[ptr++]);
        }
        return list;
    }

    public static void main(String[] args) {
//        Solution_1656 model = new Solution_1656();
//        PrintUtils.arrayInt(model.decrypt(new int[]{5, 7, 1, 4}, 3));
//        PrintUtils.arrayInt(model.decrypt(new int[]{1,2,3,4}, 0));
//        PrintUtils.arrayInt(model.decrypt(new int[]{2,4,9,3}, -2));
    }
}
